package com.hvgroup.modules.sanic.repository;

import com.hvgroup.modules.sanic.domain.po.QaMessage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

public interface QaMessageRepository extends JpaRepository<QaMessage, Long>, JpaSpecificationExecutor<QaMessage> {

    Optional<QaMessage> findFirstByChatIdOrderByCreateTimeDesc(Long chatId);

    List<QaMessage> findAllByChatIdOrderByCreateTimeAsc(Long chatId);

    void deleteByChatId(Long chatId);
}
